package com.guet.news_main.controller;


import com.guet.common.utils.R;
import com.guet.news_main.service.NewsTestService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author csp
 * @since 2021-10-10
 */
@RestController
@RequestMapping("/news_main/news-test")
public class NewsTestController {
    private final NewsTestService service;

    public NewsTestController(NewsTestService service) {
        this.service = service;
    }


    @GetMapping()
    public R getNameById(int id){
        String name=service.getById(id).getName();
        return R.ok().data("name",name);
    }
}

